CREATE Procedure CreatedTestProc
@DateOfCreation date,
@CourseID int,
@NbrOfQuestions int,
@ForeignLanguage nvarchar(50)
AS
	DECLARE @WordID TABLE(IDs int);
	INSERT INTO @WordID
	VALUES('a'),('10'),('20'),('c'),('30'),('d');
	SELECT IDs FROM @WordID;
	GO
	
	BEGIN
	
		INSERT INTO CreatedTests(DateOfCreation,CourseID,NbrOfQuestions)
		VALUES (@DateOfCreation,@CourseID,@NbrOfQuestions)
		
	END
	
	SELECT TOP @NbrOfQuestions WordID FROM ForeignLanguageWords 
	JOIN ForeignLanguages ON ForeignLanguages.ForeignLanguageID = ForeignLanguageWords.ForeignLanguageID
	WHERE ForeignLanguages.Name = @ForeignLanguage
	ORDER BY NEWID()
	
	
	
	BEGIN
	

	
	